package cn.yj.email.handle;

import cn.yj.email.executor.AbstractExecutor;
import cn.yj.email.executor.EmailExecutor;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <p>
 *
 * </p>
 *
 * @author 永健
 * @since 2019-06-01 14:01
 */
@Component
public class DefaultEmailHandler extends AbstractEmailHandler
{
    @Resource
    private JavaMailSender javaMailSender;

    @Override
    protected JavaMailSender mailSender() {
        return javaMailSender;
    }

    @Override
    protected EmailExecutor executor()
    {
        return new AbstractExecutor(){

            @Override
            protected JavaMailSender javaMailSender()
            {
                return mailSender();
            }
        };
    }

    @Override
    protected Email setEmail(Email email) {
        return email;
    }
}
